package paths

import (
	"gitee.com/ykallan/go-common-util/handler"
	"os"
	"path"
	"path/filepath"
)

func IsExist(pathIn string) bool {
	_, err := os.Stat(pathIn)
	if err == nil {
		return true
	}
	if os.IsNotExist(err) {
		return false
	}
	return false
}

func AbsPath(pathIn string) string {
	result, err := filepath.Abs(pathIn)
	handler.PanicHandler(err, "解析绝对路径出错")
	return result
}

func FileName(pathIn string) string {
	result := path.Base(pathIn)
	return result
}

func Pwd() string {
	pwdString, err := os.Getwd()
	handler.ErrorHandler(err, "???")
	return pwdString
}
